package com.learn;

/**
 * @author: liyf
 * @create: 2025-02-15 22:58
 **/
public enum MaskStrategy {

    USERNAME(s-> {
        String replace = s.replaceAll("(\\S)\\S(\\S*)", "$1*$2");
        System.out.println("replace: " + replace);
        return replace;
    }),
    ID_CARD(s->s.replace("(\\d{4})\\d{10}(\\w{4})", "$1***$2")),
    ;


    private final Desensitizer desensitizer;


    MaskStrategy(Desensitizer desensitizer) {
        this.desensitizer = desensitizer;
    }


    public Desensitizer getDesensitizer() {
        return desensitizer;
    }
}
